//
//  YHY_BannerView.m
//  YHYRealx
//
//  Created by yanghuiyan on 16/4/24.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import "YHY_BannerView.h"

@implementation YHY_BannerView

- (instancetype)initWith
{
    self = [super init];
    if (self) {
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
        NSString *states = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
        
        if ([states isEqualToString:@"YES"]) {
            //黑夜状态
            self.backgroundColor =  [UIColor colorWithRed:100/255.0 green:106/255.0 blue:107/255.0 alpha:1.0];
        }
        
        
    }
    return self;
}

- (void)changeColor:(NSNotification*)sender {
    UIColor *color = [sender object];
    
    self.backgroundColor = color;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
